using System;
using System.Data;
using System.Collections;

namespace APP.QUANLY.Entity
{
    /// <summary>
    /// Summary description for KHACHHANGTHEODOIDOANHTHU.
    /// </summary>
    public class KHACHHANGTHEODOIDOANHTHUList : CollectionBase
    {
		private string _ErrMsg;
        public string ErrMsg { get { return _ErrMsg; } }
    	public KHACHHANGTHEODOIDOANHTHUList()
    	{
	    }

		public void Add(KHACHHANGTHEODOIDOANHTHU entity)
		{
            this.List.Add(entity);
		}

		public void Add(KHACHHANGTHEODOIDOANHTHUList list)
		{	
			foreach(KHACHHANGTHEODOIDOANHTHU entity in list)
			{
				this.Add(entity);
			}
		}
	
		public new virtual Enumerator GetEnumerator()
		{
		    return new Enumerator(this);
		}
		public virtual KHACHHANGTHEODOIDOANHTHU this[int index]
		{
		    get
			{
				return (KHACHHANGTHEODOIDOANHTHU)this.List[index];
			}
			set
			{
				this.List[index] = value;
			}
		}

		#region Find Object And List Object
		//---PrimaryKey
	public virtual KHACHHANGTHEODOIDOANHTHU Find(Guid MAKHACHHANG)
	{
	    foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	    {
		if(obj.MAKHACHHANG.ToString().ToUpper().Trim() == MAKHACHHANG.ToString().ToUpper().Trim())
		{
		    obj.IsExisting = true;
		    return obj;
		}
	    }
	    return null;
	}

	public virtual KHACHHANGTHEODOIDOANHTHU Find(Int32 NAM)
	{
	    foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	    {
		if(obj.NAM.ToString().ToUpper().Trim() == NAM.ToString().ToUpper().Trim())
		{
		    obj.IsExisting = true;
		    return obj;
		}
	    }
	    return null;
	}

public virtual KHACHHANGTHEODOIDOANHTHUList FindListByMAKHACHHANG(Guid MAKHACHHANG)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
		    if(obj.MAKHACHHANG.ToString().ToUpper().Trim() == MAKHACHHANG.ToString().ToUpper().Trim())
		    {
				List.Add(obj);
		    }
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
    	{
		_ErrMsg = ex.Message;
        		return null;
    	}
}

public virtual KHACHHANGTHEODOIDOANHTHUList FindListByNAM(Int32 NAM)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
		    if(obj.NAM.ToString().ToUpper().Trim() == NAM.ToString().ToUpper().Trim())
		    {
				List.Add(obj);
		    }
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
    	{
		_ErrMsg = ex.Message;
        		return null;
    	}
}
		//---NonPrimaryKey
        public virtual KHACHHANGTHEODOIDOANHTHU FindByTHANG1(decimal THANG1)
        {
	        foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	        {
		        if(obj.THANG1.ToString().ToUpper().Trim() == THANG1.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual KHACHHANGTHEODOIDOANHTHU FindByTHANG2(decimal THANG2)
        {
	        foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	        {
		        if(obj.THANG2.ToString().ToUpper().Trim() == THANG2.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual KHACHHANGTHEODOIDOANHTHU FindByTHANG3(decimal THANG3)
        {
	        foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	        {
		        if(obj.THANG3.ToString().ToUpper().Trim() == THANG3.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual KHACHHANGTHEODOIDOANHTHU FindByTHANG4(decimal THANG4)
        {
	        foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	        {
		        if(obj.THANG4.ToString().ToUpper().Trim() == THANG4.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual KHACHHANGTHEODOIDOANHTHU FindByTHANG5(decimal THANG5)
        {
	        foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	        {
		        if(obj.THANG5.ToString().ToUpper().Trim() == THANG5.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual KHACHHANGTHEODOIDOANHTHU FindByTHANG6(decimal THANG6)
        {
	        foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	        {
		        if(obj.THANG6.ToString().ToUpper().Trim() == THANG6.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual KHACHHANGTHEODOIDOANHTHU FindByTHANG7(decimal THANG7)
        {
	        foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	        {
		        if(obj.THANG7.ToString().ToUpper().Trim() == THANG7.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual KHACHHANGTHEODOIDOANHTHU FindByTHANG8(decimal THANG8)
        {
	        foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	        {
		        if(obj.THANG8.ToString().ToUpper().Trim() == THANG8.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual KHACHHANGTHEODOIDOANHTHU FindByTHANG9(decimal THANG9)
        {
	        foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	        {
		        if(obj.THANG9.ToString().ToUpper().Trim() == THANG9.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual KHACHHANGTHEODOIDOANHTHU FindByTHANG10(decimal THANG10)
        {
	        foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	        {
		        if(obj.THANG10.ToString().ToUpper().Trim() == THANG10.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual KHACHHANGTHEODOIDOANHTHU FindByTHANG11(decimal THANG11)
        {
	        foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	        {
		        if(obj.THANG11.ToString().ToUpper().Trim() == THANG11.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual KHACHHANGTHEODOIDOANHTHU FindByTHANG12(decimal THANG12)
        {
	        foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	        {
		        if(obj.THANG12.ToString().ToUpper().Trim() == THANG12.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual KHACHHANGTHEODOIDOANHTHU FindByTHEODOI(bool THEODOI)
        {
	        foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	        {
		        if(obj.THEODOI.ToString().ToUpper().Trim() == THEODOI.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual KHACHHANGTHEODOIDOANHTHU FindByNGUOICAPNHAT(string NGUOICAPNHAT)
        {
	        foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
	        {
		        if(obj.NGUOICAPNHAT.ToString().ToUpper().Trim() == NGUOICAPNHAT.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

public virtual KHACHHANGTHEODOIDOANHTHUList FindListByTHANG1(decimal THANG1)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
			if(obj.THANG1.ToString().ToUpper().Trim() == THANG1.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual KHACHHANGTHEODOIDOANHTHUList FindListByTHANG2(decimal THANG2)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
			if(obj.THANG2.ToString().ToUpper().Trim() == THANG2.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual KHACHHANGTHEODOIDOANHTHUList FindListByTHANG3(decimal THANG3)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
			if(obj.THANG3.ToString().ToUpper().Trim() == THANG3.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual KHACHHANGTHEODOIDOANHTHUList FindListByTHANG4(decimal THANG4)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
			if(obj.THANG4.ToString().ToUpper().Trim() == THANG4.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual KHACHHANGTHEODOIDOANHTHUList FindListByTHANG5(decimal THANG5)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
			if(obj.THANG5.ToString().ToUpper().Trim() == THANG5.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual KHACHHANGTHEODOIDOANHTHUList FindListByTHANG6(decimal THANG6)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
			if(obj.THANG6.ToString().ToUpper().Trim() == THANG6.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual KHACHHANGTHEODOIDOANHTHUList FindListByTHANG7(decimal THANG7)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
			if(obj.THANG7.ToString().ToUpper().Trim() == THANG7.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual KHACHHANGTHEODOIDOANHTHUList FindListByTHANG8(decimal THANG8)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
			if(obj.THANG8.ToString().ToUpper().Trim() == THANG8.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual KHACHHANGTHEODOIDOANHTHUList FindListByTHANG9(decimal THANG9)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
			if(obj.THANG9.ToString().ToUpper().Trim() == THANG9.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual KHACHHANGTHEODOIDOANHTHUList FindListByTHANG10(decimal THANG10)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
			if(obj.THANG10.ToString().ToUpper().Trim() == THANG10.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual KHACHHANGTHEODOIDOANHTHUList FindListByTHANG11(decimal THANG11)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
			if(obj.THANG11.ToString().ToUpper().Trim() == THANG11.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual KHACHHANGTHEODOIDOANHTHUList FindListByTHANG12(decimal THANG12)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
			if(obj.THANG12.ToString().ToUpper().Trim() == THANG12.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual KHACHHANGTHEODOIDOANHTHUList FindListByTHEODOI(bool THEODOI)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
			if(obj.THEODOI.ToString().ToUpper().Trim() == THEODOI.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual KHACHHANGTHEODOIDOANHTHUList FindListByNGUOICAPNHAT(string NGUOICAPNHAT)
{
	try
	{
		KHACHHANGTHEODOIDOANHTHUList List = new KHACHHANGTHEODOIDOANHTHUList();
		foreach (KHACHHANGTHEODOIDOANHTHU obj in this.List)
		{
			if(obj.NGUOICAPNHAT.ToString().ToUpper().Trim() == NGUOICAPNHAT.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}
		#endregion
     
		#region Inner Classes
		/// <summary>
		/// Type-specific enumeration class, used by LogCollection.GetEnumerator.
		/// </summary>
		public class Enumerator : IEnumerator
		{
			private IEnumerator wrapped;

			public Enumerator(KHACHHANGTHEODOIDOANHTHUList collection)
			{
				this.wrapped = ((CollectionBase)collection).GetEnumerator();
			}

			public KHACHHANGTHEODOIDOANHTHU Current
			{
				get
				{
					return (KHACHHANGTHEODOIDOANHTHU)(this.wrapped.Current);
				}
			}

			object IEnumerator.Current
			{
				get
				{
					return (KHACHHANGTHEODOIDOANHTHU)(this.wrapped.Current);
				}
			}

			public bool MoveNext()
			{
				return this.wrapped.MoveNext();
			}

			public void Reset()
			{
				this.wrapped.Reset();
			}
      }
      #endregion  
   }
}